package com.victorvieux.android.handlers;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class StatusHandler extends DefaultHandler {
	private String current = new String();
	private boolean playing = false;    
	
	@Override
     public void startElement(String ns, String sName, String qName,
        Attributes attrs) throws SAXException {
        current = sName;
     }
	
	@Override
     public void characters(char buf[], int offset, int len)
        throws SAXException {
		String content = new String(buf, offset, len);
		if (current.equals("state")) {
    		 if (content.equals("playing")) {
    			 playing = true;
    		 }
  
    	 }
     }
	
	public boolean isPlaying() {
		return playing;
	}
}
